<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>扣费记录</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="{{asset('/layuiadmin/layui/css/layui.css')}}" media="all">
  <link rel="stylesheet" href="{{asset('/layuiadmin/style/admin.css')}}" media="all">
  <style>
    .edit{background-color: #ed9c3a;}
    .shenhe{background-color: #429488;}    
    .see{background-color: #7cb717;} 
    .tongbu{background-color: #4c9ef8;color:#fff;}
    .cur{color:#009688;}
  </style>
</head>
<body>

  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-col-md12">

        <div class="layui-fluid">
          <div class="layui-row layui-col-space15">
            <div class="layui-col-md12" style="margin-top:0px">
              <div class="layui-card"> 
                <div class="layui-card-header">关联机构</div>

                <div class="layui-card-body">
                    
                  <div class="layui-btn-container" style="font-size:14px;">
                    <!--<a class="layui-btn layui-btn-primary addcashier" lay-href="" style="background-color:#3475c3;border-radius: 5px;border:none;color:#fff;display: inline-block;width: 122px;">添加单品</a>-->
                  </div>
                  
                  <div class="layui-form-item js_phone" style="width:500px">
                    <label class="layui-form-label" style="text-align:center;">机构号</label>
                    <div class="layui-input-block">
                        <input type="text" placeholder="请输入机构号" class="layui-input phone">
                    </div>
                  </div>
                  
                  <div class="layui-form-item">
                    <div class="layui-input-block" style="margin-left:440px">
                        <div class="layui-footer">
                            <button class="layui-btn submit2" style="border-radius:5px">保存</button>
                        </div>
                    </div>
                  </div>
                  
                  
                  <!--<table class="layui-hide" id="test-table-page" lay-filter="test-table-page"></table>-->
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>

    </div>
  </div>
  <input type="hidden" class="store_id">
  <input type="hidden" class="sort">
  <input type="hidden" class="stu_class_no">

  <input type="hidden" class="stu_order_batch_no">
  <input type="hidden" class="user_id">

  <input type="hidden" class="pay_status">
  <input type="hidden" class="pay_type">

  <script src="{{asset('/layuiadmin/layui/layui.js')}}"></script> 
  <script src="{{asset('/layuiadmin/jquery.min.js')}}"></script>
<script src="{{asset('/layuiadmin/jquerysession.js')}}"></script>
    <script>
    var token = localStorage.getItem("Usertoken");
    
    var str=location.search;
    var store_id=str.split('?')[1];

    
    layui.config({
      base: '../../layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','form','table','laydate'], function(){
        var $ = layui.$
            ,admin = layui.admin
            ,form = layui.form
            ,table = layui.table
            ,laydate = layui.laydate;
      // 未登录,跳转登录页面
      $(document).ready(function(){        
          if(token==null){
              window.location.href="{{url('/user/login')}}"; 
          }
      })

      // 查看机构号
      $.get("{{url('/api/v2/Mechanism/Merchant/get')}}",
        {
            token:token
            ,store_id:store_id
        },function(res){
            if(res.status==1){
                $('.phone').val(res.mechanism_id)
            }else{
              layer.msg(res.message, {
                  offset: '50px'
                  ,icon: 2
                  ,time: 3000
              });
            }
        },"json")
      
      // 提交门店信息22222222
        $('.submit2').click(function(){
            var pass =$.session.get('pass');
            // 重置cookie有效期
            var time = Date.parse(new Date()) + (5 * 60 * 1000);
            $.session.set('time', time);
            
            $.post("{{url('/api/user/mechanism_merchant_add')}}",
            {
                token:token,
                store_id: store_id,

                mechanism_id:$('.phone').val(),
                pass: pass,
                path: 'api/user/mechanism_merchant_add',
            },function(res){
                console.log(res);
                if(res.status==1){
                    layer.msg(res.message, {
                        offset: '50px'
                        ,icon: 1
                        ,time: 3000
                    });
                }else{
                    layer.msg(res.message, {
                        offset: '50px'
                        ,icon: 2
                        ,time: 3000
                    });
                }
            },"json");
        });
        

      // 渲染表格
    //   table.render({
    //       elem: '#test-table-page'
    //       ,url: "{{url('/api/user/feeDetail')}}"
    //       ,method: 'post'
    //       ,where:{
    //         token: token,
    //         store_id: store_id
    //       }
    //       ,request:{
    //         pageName: 'p', 
    //         limitName: 'l'
    //       }
    //       ,page: true
    //       ,cellMinWidth: 150
    //       ,cols: [[
    //         {field: 'count', title: '扣费总金额'},
    //         {field: 'before_money', title: '结算前金额'},
    //         {field: 'end_money', title: '结算后金额'},
    //         {field: 'order_count', title: '订单总金额'},
    //         // {field: 'status', title: '扣费状态'},
    //          {field: 'settling_day', title: '结算日期'},
    //       ]]
    //       ,response: {
    //         statusName: 'status' //数据状态的字段名称，默认：code
    //         ,statusCode: 1 //成功的状态码，默认：0
    //         ,msgName: 'message' //状态信息的字段名称，默认：msg
    //         ,countName: 't' //数据总数的字段名称，默认：count
    //         ,dataName: 'data' //数据列表的字段名称，默认：data
    //       } 
    //       ,done: function(res, curr, count){              
    //         $('th').css({'font-weight': 'bold', 'font-size': '15','color': 'black','background':'linear-gradient(#f2f2f2,#cfcfcf)'});	//进行表头样式设置
    //       }

    //   });

    
    });
    
    

  </script>

</body>
</html>





